﻿using System.IO;
using System;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Marbles.Core.Web.Cart.StateProviders
{
    public abstract class CartStateProvider
    {

        public Cart DeSerializeCart(string Xml)
        {
            XmlSerializer ser = new XmlSerializer(typeof(Cart));
            StringReader sr = new StringReader(Xml);
            return ser.Deserialize(sr) as Cart;
        }

        public string SerializeCart(Cart Cart)
        {
            XmlSerializer ser = new XmlSerializer(Cart.GetType());
            StringWriter sw = new StringWriter();
            ser.Serialize(sw, Cart);
            sw.Flush();
            return sw.ToString();
        }
    }
}
